
import QtQuick 1.0
//import Qt.labs.folderlistmodel 1.0

// prend exemple sur http://www.pluzz.fr/c-dans-l-air.html?sortie=rss

ListView {
   /* width : 400
    height:500
    */
    id:podcastItem
    signal selectPodcast(string url)
    //x:30
    spacing:20
    focus:true
    property alias urlRss : xmlModel.source
    model: XmlListModel {
	id: xmlModel
	//source: "http://www.pluzz.fr/c-dans-l-air.html?sortie=rss"
	query: "/rss/channel/item"
	XmlRole { name: "title"; query: "title/string()" }
	XmlRole { name: "pubDate"; query: "pubDate/string()" }
	XmlRole { name: "description"; query: "description/string()" }
	XmlRole { name: "imageSrc"; query: "image/string()" }
	XmlRole { name: "link"; query: "link/string()" }
    }
    delegate: Rectangle {
		id: delRect
		width: podcastItem.width-50
		height: 50
		color: '#FCFFA5'//"#91AA9D"
		smooth: true
		radius: 10
		Text {
		  id: label
		  width: parent.width
		  wrapMode:Text.WrapAnywhere
		  anchors.verticalCenter: parent.verticalCenter
		  //anchors.left:img.right
		  text: title
		  color: "#193441"
		  font.pixelSize: 15
		}

		Keys.onPressed: {
			    if (event.key == Qt.Key_Return) {
				console.log("selected*** :"  + link );
				podcastItem.selectPodcast(link);
				event.accepted = true;
			    }
		}
		
		states: State {
		    name: "active"; when: delRect.activeFocus
		    PropertyChanges { target: delRect; color: "#91AA9D"; scale: 1.2 }
		    //PropertyChanges { target: delRect;  x:30 }
		    //PropertyChanges { target: label; font.pixelSize: 25 }
		    
		}

		transitions: Transition {
		    NumberAnimation { properties: "scale"; duration: 100 }
		    NumberAnimation { properties: "x"; duration: 100 }
		}
	    }
}
